package 线程安全问题.死锁.Test01;

public class MyRunnable02 implements Runnable {
    Object o1;
    Object o2;

    public MyRunnable02(Object o1, Object o2) {
        this.o1 = o1;
        this.o2 = o2;
    }
    @Override
    public void run() {
        synchronized(o2){
            System.out.println(Thread.currentThread().getName() + "拿到o2对象锁");
            synchronized(o1){
                System.out.println(Thread.currentThread().getName() + "拿到o1对象锁");
            }
        }
    }
}
